package com.jk.io;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author yzf
 * @version 1.0
 * @ClassName FileOutputStreamConstructor
 * @program: yzf-test
 * @description: TODO
 * @date 2025/3/3 16:03
 */
public class FileOutputStreamConstructor {
    public static void main(String[] args) throws IOException {
        // 使用File对象创建流对象

        File file = new File("a.txt");
        FileOutputStream fos = new FileOutputStream("myio\\a.txt",true);
        byte[] bytes = {97,98,99,100};
        fos.write(bytes,1,2);
        //4.释放资源
        fos.close();



        // 使用文件名称创建流对象
//        FileOutputStream fos = new FileOutputStream("b.txt");
    }

}
